package com.compmov.socialnetwork;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.PopupWindow;

public class PopUp extends Activity

{
	final LayoutInflater inflater = (LayoutInflater) this
			.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	/** Called when the activity is first created. */

	Button ok;

	public void onCreate(Bundle savedInstanceState)

	{

		super.onCreate(savedInstanceState);

		setContentView(R.layout.new_contact);

		ok = (Button) findViewById(R.id.btnpopup);

		ok.setOnClickListener(new View.OnClickListener()

		{

			public void onClick(View v) {

				// this is the code for popup window

				View pview = inflater.inflate(R.layout.pop_up,
						(ViewGroup) findViewById(R.layout.new_contact));
				PopupWindow pw = new PopupWindow(pview);
				pw.showAtLocation(v, Gravity.LEFT, 0, 0);
				pw.update(8, -70, 150, 270);

				// if onclick written here, it gives null pointer exception.
				ImageButton img = (ImageButton) pview
						.findViewById(R.id.btnDetalles);

			}

		});

	}

}
